<html>
<head><meta charset="utf-8"><title>DHAT and rustdoc · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html">DHAT and rustdoc</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="219655533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219655533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219655533">(Dec 11 2020 at 20:07)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@njn</span> how does DHAT compare to the <code>self-profile</code> framework?</p>



<a name="219657965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219657965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219657965">(Dec 11 2020 at 20:30)</a>:</h4>
<p>hmm, I couldn't get this to work with rustdoc:</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/src/tools/rustdoc/Cargo.toml b/src/tools/rustdoc/Cargo.toml</span>
<span class="gh">index 36aa5916da7..b9b05ec38da 100644</span>
<span class="gd">--- a/src/tools/rustdoc/Cargo.toml</span>
<span class="gi">+++ b/src/tools/rustdoc/Cargo.toml</span>
<span class="gu">@@ -13,3 +13,4 @@ path = "main.rs"</span>

 [dependencies]
 rustdoc = { path = "../../librustdoc" }
<span class="gi">+dhat = "0.1"</span>
<span class="gh">diff --git a/src/tools/rustdoc/main.rs b/src/tools/rustdoc/main.rs</span>
<span class="gh">index 5b499a1fa1f..3876b03fa4c 100644</span>
<span class="gd">--- a/src/tools/rustdoc/main.rs</span>
<span class="gi">+++ b/src/tools/rustdoc/main.rs</span>
<span class="gu">@@ -1,3 +1,9 @@</span>
<span class="gi">+use dhat::{Dhat, DhatAlloc};</span>
<span class="gi">+</span>
<span class="gi">+#[global_allocator]</span>
<span class="gi">+static ALLOCATOR: DhatAlloc = DhatAlloc;</span>
<span class="gi">+</span>
 fn main() {
<span class="gd">-    rustdoc::main()</span>
<span class="gi">+    let _dhat = Dhat::start_heap_profiling();</span>
<span class="gi">+    rustdoc::main();</span>
 }
</code></pre></div>
<p>there's no output from DHAT or .json file:</p>
<div class="codehilite"><pre><span></span><code>$ rustdoc +stage1 --version
rustdoc 1.50.0-dev
</code></pre></div>



<a name="219658149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219658149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219658149">(Dec 11 2020 at 20:31)</a>:</h4>
<p>oh! I think it's because it's calling process::exit instead of returning normally</p>



<a name="219658229"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219658229" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219658229">(Dec 11 2020 at 20:32)</a>:</h4>
<p>would be neat if there were a way to intercept that somehow</p>



<a name="219658528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219658528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219658528">(Dec 11 2020 at 20:34)</a>:</h4>
<p>oh boooo rustdoc catches <em>every</em> code with process::exit even if it's successful, that's rude</p>



<a name="219659089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219659089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219659089">(Dec 11 2020 at 20:39)</a>:</h4>
<p>ok yes changing that fixed it</p>



<a name="219661925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219661925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219661925">(Dec 11 2020 at 21:03)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@njn</span> hmm, it always shows me 0 MB allocated no matter what</p>
<div class="codehilite"><pre><span></span><code>dhat: Total:     0 bytes in 0 blocks
dhat: At t-gmax: 0 bytes in 0 blocks
dhat: At t-end:  0 bytes in 0 blocks
dhat: The data in dhat-heap.json is viewable with dhat/dh_view.html
</code></pre></div>
<p>maybe rustc is overriding the global allocator somehow? not sure what I'm doing wrong</p>



<a name="219662022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662022">(Dec 11 2020 at 21:04)</a>:</h4>
<p>here's the json file in case it matters:</p>
<div class="codehilite" data-code-language="JSON"><pre><span></span><code><span class="p">{</span>
  <span class="nt">"dhatFileVersion"</span><span class="p">:</span> <span class="mi">2</span><span class="p">,</span>
  <span class="nt">"mode"</span><span class="p">:</span> <span class="s2">"rust-heap"</span><span class="p">,</span>
  <span class="nt">"verb"</span><span class="p">:</span> <span class="s2">"Allocated"</span><span class="p">,</span>
  <span class="nt">"bklt"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
  <span class="nt">"bkacc"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
  <span class="nt">"tu"</span><span class="p">:</span> <span class="s2">"µs"</span><span class="p">,</span>
  <span class="nt">"Mtu"</span><span class="p">:</span> <span class="s2">"s"</span><span class="p">,</span>
  <span class="nt">"tuth"</span><span class="p">:</span> <span class="mi">10</span><span class="p">,</span>
  <span class="nt">"cmd"</span><span class="p">:</span> <span class="s2">"/home/joshua/.local/lib/rustup/toolchains/stage1/bin/rustdoc --edition=2018 --crate-type lib --crate-name stm32h7xx_hal src/lib.rs -o /home/joshua/stm32h7xx-hal/target/doc --cfg feature=\"default\" --cfg feature=\"device-selected\" --cfg feature=\"rm0433\" --cfg feature=\"stm32h742\" --cfg feature=\"unproven\" --error-format=json --json=diagnostic-rendered-ansi -L dependency=/home/joshua/stm32h7xx-hal/target/debug/deps --extern bare_metal=/home/joshua/stm32h7xx-hal/target/debug/deps/libbare_metal-b638650e24c983d6.rmeta --extern cast=/home/joshua/stm32h7xx-hal/target/debug/deps/libcast-b0b77c08a1b60a35.rmeta --extern cortex_m=/home/joshua/stm32h7xx-hal/target/debug/deps/libcortex_m-d6410f0e6e3645ac.rmeta --extern cortex_m_rt=/home/joshua/stm32h7xx-hal/target/debug/deps/libcortex_m_rt-8ec1a455b0abe068.rmeta --extern embedded_hal=/home/joshua/stm32h7xx-hal/target/debug/deps/libembedded_hal-b5f4b69e0567e3fb.rmeta --extern nb=/home/joshua/stm32h7xx-hal/target/debug/deps/libnb-1dc7c396850f6243.rmeta --extern paste=/home/joshua/stm32h7xx-hal/target/debug/deps/libpaste-d4fad1d9f130d2fb.so --extern stm32h7=/home/joshua/stm32h7xx-hal/target/debug/deps/libstm32h7-eef1a06249d842d1.rmeta --extern void=/home/joshua/stm32h7xx-hal/target/debug/deps/libvoid-0a792be597e5ef56.rmeta --crate-version 0.8.0"</span><span class="p">,</span>
  <span class="nt">"pid"</span><span class="p">:</span> <span class="mi">31534</span><span class="p">,</span>
  <span class="nt">"tg"</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
  <span class="nt">"te"</span><span class="p">:</span> <span class="mi">155340789</span><span class="p">,</span>
  <span class="nt">"pps"</span><span class="p">:</span> <span class="p">[],</span>
  <span class="nt">"ftbl"</span><span class="p">:</span> <span class="p">[</span>
    <span class="s2">"[root]"</span>
  <span class="p">]</span>
<span class="p">}</span>
</code></pre></div>



<a name="219662050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662050">(Dec 11 2020 at 21:04)</a>:</h4>
<p>(which I know for a fact is using several GB of memory)</p>



<a name="219662173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662173">(Dec 11 2020 at 21:06)</a>:</h4>
<p>let me try this on a program smaller than rustdoc</p>



<a name="219662262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662262">(Dec 11 2020 at 21:06)</a>:</h4>
<p><code>rustc/src/main.rs</code> optionally uses jemalloc, but it doesn't look like <code>rustdoc</code> ever does</p>



<a name="219662360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662360">(Dec 11 2020 at 21:07)</a>:</h4>
<p>I don't <em>think</em> I'm setting jemalloc-sys anywhere</p>



<a name="219662457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Steven Fackler <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662457">(Dec 11 2020 at 21:08)</a>:</h4>
<p>You can't set 2 #[global_allocator]s, so that wouldn't be the issue</p>



<a name="219662554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662554">(Dec 11 2020 at 21:09)</a>:</h4>
<p>this works on a hello world program, not sure what's going on :/</p>
<div class="codehilite"><pre><span></span><code>Hello, world!
dhat: Total:     1,112 bytes in 3 blocks
dhat: At t-gmax: 1,112 bytes in 3 blocks
dhat: At t-end:  1,112 bytes in 3 blocks
dhat: The data in dhat-heap.json is viewable with dhat/dh_view.html
</code></pre></div>



<a name="219662636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662636">(Dec 11 2020 at 21:10)</a>:</h4>
<p>maybe it has something to do with dynamic linking?</p>



<a name="219662650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662650">(Dec 11 2020 at 21:10)</a>:</h4>
<p>I'll try adding this to src/librustdoc instead of src/tools/rustdoc</p>



<a name="219662974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219662974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219662974">(Dec 11 2020 at 21:13)</a>:</h4>
<p>nothing :(</p>



<a name="219663089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663089">(Dec 11 2020 at 21:14)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> I tried using dhat-rs on rustc itself and likewise failed. I didn't know about the <code>process::exit</code> thing, that's surprising. I guess you can <code>drop(_dhat)</code> just before that point, if <code>process::exit</code> is within main.</p>



<a name="219663115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663115">(Dec 11 2020 at 21:14)</a>:</h4>
<p>yeah, <code>drop(_dhat)</code> from with <code>librustdoc::main</code> worked</p>



<a name="219663133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663133">(Dec 11 2020 at 21:15)</a>:</h4>
<p>the process::exit is in librustdoc so it doesn't work from src/tools/rustdoc unfortunately</p>



<a name="219663148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663148">(Dec 11 2020 at 21:15)</a>:</h4>
<p>As for the zero numbers, that indicates that the allocator replacement isn't working, but I don't know why that would be the case. I'm not much of an expert on how allocator replacement works</p>



<a name="219663162"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663162" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663162">(Dec 11 2020 at 21:15)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/Rust.20performance.20book/near/219663115">said</a>:</p>
<blockquote>
<p>yeah, <code>drop(_dhat)</code> from with <code>librustdoc::main</code> worked</p>
</blockquote>
<p>(worked in the sense that it printed 0 bytes)</p>



<a name="219663177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663177">(Dec 11 2020 at 21:15)</a>:</h4>
<p>Right, fixes the first of the two problems</p>



<a name="219663259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663259">(Dec 11 2020 at 21:16)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120989">njn</span> <a href="#narrow/stream/122651-general/topic/Rust.20performance.20book/near/219663148">said</a>:</p>
<blockquote>
<p>As for the zero numbers, that indicates that the allocator replacement isn't working, but I don't know why that would be the case. I'm not much of an expert on how allocator replacement works</p>
</blockquote>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> do you happen to know why <code>#[global_allocator]</code> doesn't work for either rustc or rustdoc?</p>



<a name="219663280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663280">(Dec 11 2020 at 21:16)</a>:</h4>
<p>I tried modifying both src/tools/rustdoc and src/librustdoc without success</p>



<a name="219663298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663298">(Dec 11 2020 at 21:16)</a>:</h4>
<p>uh</p>



<a name="219663303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663303">(Dec 11 2020 at 21:16)</a>:</h4>
<p>grep for it?</p>



<a name="219663322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663322">(Dec 11 2020 at 21:16)</a>:</h4>
<p>remove it for the compiler</p>



<a name="219663329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663329">(Dec 11 2020 at 21:16)</a>:</h4>
<p>There is a <code>dhat::finish</code> function that <code>Dhat:drop</code> calls. I guess I could make that public so that people could call it in a different place from where <code>Dhat</code> is created</p>



<a name="219663341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663341">(Dec 11 2020 at 21:17)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@njn</span> nah, drop works well enough</p>



<a name="219663390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663390">(Dec 11 2020 at 21:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/122651-general/topic/Rust.20performance.20book/near/219663303">said</a>:</p>
<blockquote>
<p>grep for it?</p>
</blockquote>
<p>nothing:</p>
<div class="codehilite"><pre><span></span><code>rg &#39;#\[global_allocator&#39; compiler/
compiler/rustc_metadata/src/creader.rs
41:    /// This crate has a `#[global_allocator]` item.
776:                        &quot;the `#[global_allocator]` in {} \
806:                           add `#[global_allocator]` to a static item \

compiler/rustc_codegen_cranelift/example/alloc_example.rs
11:#[global_allocator]

compiler/rustc_codegen_cranelift/build_sysroot/alloc_system/lib.rs
52:/// with the `#[global_allocator]` attribute
59:/// #[global_allocator]

compiler/rustc_feature/src/accepted.rs
155:    /// Allows the `#[global_allocator]` attribute.

compiler/rustc_builtin_macros/src/global_allocator.rs
28:    // Allow using `#[global_allocator]` on an item statement

compiler/rustc_feature/src/active.rs
200:    /// Allows using `#![needs_allocator]`, an implementation detail of `#[global_allocator]`.
</code></pre></div>



<a name="219663392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663392">(Dec 11 2020 at 21:17)</a>:</h4>
<p>But if the <code>process::exit</code> is some distance from <code>main</code>, you'd have to pass the <code>Dhat</code> around</p>



<a name="219663433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663433">(Dec 11 2020 at 21:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120989">njn</span> <a href="#narrow/stream/122651-general/topic/Rust.20performance.20book/near/219663329">said</a>:</p>
<blockquote>
<p>There is a <code>dhat::finish</code> function that <code>Dhat:drop</code> calls. I guess I could make that public so that people could call it in a different place from where <code>Dhat</code> is created</p>
</blockquote>
<p>(it would be nice for <code>let _dhat = Dhat;</code> not to compile though, I made that mistake)</p>



<a name="219663449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663449">(Dec 11 2020 at 21:17)</a>:</h4>
<p>oh</p>



<a name="219663491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663491">(Dec 11 2020 at 21:18)</a>:</h4>
<p>jemallocator probably has it?</p>



<a name="219663499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663499">(Dec 11 2020 at 21:18)</a>:</h4>
<p>I don't know</p>



<a name="219663511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663511">(Dec 11 2020 at 21:18)</a>:</h4>
<p>ok, no problem</p>



<a name="219663536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663536">(Dec 11 2020 at 21:18)</a>:</h4>
<p>back to bashing my head against bootstrap <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> I seem to do an awful lot of that</p>



<a name="219663587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663587">(Dec 11 2020 at 21:19)</a>:</h4>
<p>this is how jemalloc works for reference: <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs">https://github.com/rust-lang/rust/blob/master/compiler/rustc/src/main.rs</a></p>



<a name="219663611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663611">(Dec 11 2020 at 21:19)</a>:</h4>
<p>looks very cursed</p>



<a name="219663622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eh2406 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663622">(Dec 11 2020 at 21:19)</a>:</h4>
<p>BTW I was going to post an issue for a way to not count allocations in set up code. But, just moving the <code>let _dhat = Dhat::start_heap_profiling();</code> to after the set up workes grate.</p>



<a name="219663769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219663769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219663769">(Dec 11 2020 at 21:20)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span> second cursed question: I assume there's no way to link rustc_driver and company statically?</p>



<a name="219665915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219665915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219665915">(Dec 11 2020 at 21:40)</a>:</h4>
<p>not sure. seems like it probably is, I don't see any reason why not</p>



<a name="219665923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219665923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219665923">(Dec 11 2020 at 21:40)</a>:</h4>
<p>maybe try removing dylib from crate types.</p>



<a name="219666167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219666167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219666167">(Dec 11 2020 at 21:42)</a>:</h4>
<p>I've only skimmed this thread, so maybe this doesn't apply, but I've found I need to run profilers against <code>$(rustup +toolchain which rustc)</code>, not <code>rustc +toolchain</code>, so that it runs against the real binary, not the shim, or whatever the terminology is.</p>



<a name="219666203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219666203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219666203">(Dec 11 2020 at 21:42)</a>:</h4>
<p><span class="user-mention" data-user-id="306073">@Tyson Nottingham</span> this isn't an external process, it's a global allocator</p>



<a name="219666212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219666212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219666212">(Dec 11 2020 at 21:43)</a>:</h4>
<p>so it's part of the binary itself</p>



<a name="219666220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219666220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tyson Nottingham <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219666220">(Dec 11 2020 at 21:43)</a>:</h4>
<p>Ah, okay :)</p>



<a name="219666430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219666430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219666430">(Dec 11 2020 at 21:45)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116122">simulacrum</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219665923">said</a>:</p>
<blockquote>
<p>maybe try removing dylib from crate types.</p>
</blockquote>
<p>no idea why but this fixed it - thank you so much!</p>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code><span class="gh">diff --git a/compiler/rustc_driver/Cargo.toml b/compiler/rustc_driver/Cargo.toml</span>
<span class="gh">index 0adc006b624..781c680ae82 100644</span>
<span class="gd">--- a/compiler/rustc_driver/Cargo.toml</span>
<span class="gi">+++ b/compiler/rustc_driver/Cargo.toml</span>
<span class="gu">@@ -4,8 +4,8 @@ name = "rustc_driver"</span>
 version = "0.0.0"
 edition = "2018"

<span class="gd">-[lib]</span>
<span class="gd">-crate-type = ["dylib"]</span>
<span class="gi">+#[lib]</span>
<span class="gi">+#crate-type = ["dylib"]</span>

 [dependencies]
 libc = "0.2"
</code></pre></div>



<a name="219666747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219666747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219666747">(Dec 11 2020 at 21:48)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120989">njn</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219663089">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> I tried using dhat-rs on rustc itself and likewise failed. I didn't know about the <code>process::exit</code> thing, that's surprising. I guess you can <code>drop(_dhat)</code> just before that point, if <code>process::exit</code> is within main.</p>
</blockquote>
<p>hmm, there's no <code>at_exit</code> unfortunately</p>



<a name="219666838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219666838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219666838">(Dec 11 2020 at 21:49)</a>:</h4>
<p>well, there is, but it doesn't seem to be stable: <a href="https://github.com/rust-lang/rust/blob/master/library/std/src/sys_common/mod.rs#L121">https://github.com/rust-lang/rust/blob/master/library/std/src/sys_common/mod.rs#L121</a></p>



<a name="219667730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219667730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219667730">(Dec 11 2020 at 21:58)</a>:</h4>
<p><a href="#narrow/stream/219381-t-libs/topic/at_exit.20.3F">https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/at_exit.20.3F</a></p>



<a name="219667751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219667751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219667751">(Dec 11 2020 at 21:58)</a>:</h4>
<p>wow, rustdoc is still going <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> I started it running on stm32 with DHAT like 15 minutes ago</p>



<a name="219667761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219667761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219667761">(Dec 11 2020 at 21:58)</a>:</h4>
<p>hasn't even gotten to intra-doc links yet</p>



<a name="219669766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219669766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219669766">(Dec 11 2020 at 22:21)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@njn</span> do you happen to have benchmarks for DHAT itself? it's slowing down rustdoc an awful lot ...</p>



<a name="219670020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219670020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219670020">(Dec 11 2020 at 22:24)</a>:</h4>
<p>well, I guess that's something to do while I wait lol <a href="https://github.com/nnethercote/dhat-rs/pull/7">https://github.com/nnethercote/dhat-rs/pull/7</a></p>



<a name="219670080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219670080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219670080">(Dec 11 2020 at 22:25)</a>:</h4>
<p><span class="user-mention" data-user-id="232545">@Joshua Nelson</span> I have done very little perf measurement</p>



<a name="219670129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219670129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219670129">(Dec 11 2020 at 22:26)</a>:</h4>
<p>30x is very high :(</p>



<a name="219670219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219670219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219670219">(Dec 11 2020 at 22:27)</a>:</h4>
<p>well, I don't have exact numbers, but rustdoc took a minute and a half without DHAT and with DHAT ... well, I started it at 4:45 and it's still running.</p>



<a name="219670242"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219670242" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219670242">(Dec 11 2020 at 22:27)</a>:</h4>
<p>in your defense, it is allocating a total of over 50 GB IIRC</p>



<a name="219670246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219670246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219670246">(Dec 11 2020 at 22:27)</a>:</h4>
<p>but still</p>



<a name="219671021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671021">(Dec 11 2020 at 22:37)</a>:</h4>
<div class="codehilite"><pre><span></span><code>Finished dev [unoptimized + debuginfo] target(s) in 51m 56s
</code></pre></div>

<p>whew</p>



<a name="219671070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671070">(Dec 11 2020 at 22:38)</a>:</h4>
<div class="codehilite"><pre><span></span><code>dhat: Total:     39,304,210,661 bytes in 176,996,655 blocks
dhat: At t-gmax: 2,328,561,660 bytes in 7,955,048 blocks
dhat: At t-end:  6,344 bytes in 6 blocks
dhat: The data in dhat-heap.json is viewable with dhat/dh_view.html
</code></pre></div>



<a name="219671448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671448">(Dec 11 2020 at 22:43)</a>:</h4>
<p>if someone wants a copy LMK, I can arrange SFTP access but I don't know where else I can store 71 MB of JSON haha</p>



<a name="219671551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671551">(Dec 11 2020 at 22:44)</a>:</h4>
<p><span class="user-mention" data-user-id="120989">@njn</span> do you know a way to sort the output by max allocation? I only see by total <a href="/user_uploads/4715/obhxID9Fz4YZzACDg8ELGxfg/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/obhxID9Fz4YZzACDg8ELGxfg/image.png" title="image.png"><img src="/user_uploads/4715/obhxID9Fz4YZzACDg8ELGxfg/image.png"></a></div>



<a name="219671569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671569">(Dec 11 2020 at 22:44)</a>:</h4>
<p>oh I think gmax is it, sorry for the ping</p>



<a name="219671593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> njn <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671593">(Dec 11 2020 at 22:44)</a>:</h4>
<p>Yes, t-gmax is "time of global heap max"</p>



<a name="219671618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671618">(Dec 11 2020 at 22:45)</a>:</h4>
<p>I'm having trouble reading the results - what does 'children' mean in this context?</p>



<a name="219671625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671625">(Dec 11 2020 at 22:45)</a>:</h4>
<p>and 1.1/9?</p>



<a name="219671709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671709">(Dec 11 2020 at 22:46)</a>:</h4>
<p>oh it says here: <a href="https://valgrind.org/docs/manual/dh-manual.html">https://valgrind.org/docs/manual/dh-manual.html</a></p>



<a name="219671794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219671794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219671794">(Dec 11 2020 at 22:47)</a>:</h4>
<p>ok, so get_blanket_impls is at least <em>partially</em> to blame lol <a href="/user_uploads/4715/LoIbq-OnvKSABpKCqD3QdgW4/image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/LoIbq-OnvKSABpKCqD3QdgW4/image.png" title="image.png"><img src="/user_uploads/4715/LoIbq-OnvKSABpKCqD3QdgW4/image.png"></a></div>



<a name="219672128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219672128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219672128">(Dec 11 2020 at 22:51)</a>:</h4>
<p>I'm also a little nervous this is missing allocations - I recorded 8.5 GB a while ago and I doubt it went down by a factor of 4 without anyone noticing</p>



<a name="219672137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219672137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219672137">(Dec 11 2020 at 22:51)</a>:</h4>
<p>let me run this again without DHAT just in case</p>



<a name="219674122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219674122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219674122">(Dec 11 2020 at 23:21)</a>:</h4>
<p>well there's good news and bad news - the bad news is the usage comes from just having a metric ton of <code>Item</code>s all stored for the lifetime of the process</p>



<a name="219674131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219674131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219674131">(Dec 11 2020 at 23:21)</a>:</h4>
<p>the good news is that means even small changes to the size of <code>Item</code> will have an outsized impact</p>



<a name="219674201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219674201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219674201">(Dec 11 2020 at 23:22)</a>:</h4>
<p>e.g. I think boxing <code>ItemKind</code> could help</p>



<a name="219674518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219674518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219674518">(Dec 11 2020 at 23:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219672128">said</a>:</p>
<blockquote>
<p>I'm also a little nervous this is missing allocations - I recorded 8.5 GB a while ago and I doubt it went down by a factor of 4 without anyone noticing</p>
</blockquote>
<p>oh huh it was 2.5 GB even without DHAT</p>



<a name="219674533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219674533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219674533">(Dec 11 2020 at 23:27)</a>:</h4>
<p>maybe this is related to -Z self-profile and that has more accurate measurements? that seems unlikely though</p>



<a name="219674712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219674712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219674712">(Dec 11 2020 at 23:30)</a>:</h4>
<p>god damn no wonder</p>
<div class="codehilite"><pre><span></span><code>[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;Item&gt;() = 784
[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;ItemKind&gt;() = 408
</code></pre></div>



<a name="219674716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219674716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219674716">(Dec 11 2020 at 23:30)</a>:</h4>
<p>that's like a kilobyte per item lol</p>



<a name="219675156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219675156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219675156">(Dec 11 2020 at 23:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219674533">said</a>:</p>
<blockquote>
<p>maybe this is related to -Z self-profile and that has more accurate measurements? that seems unlikely though</p>
</blockquote>
<p>nope, time-passes reports the same. not sure where I got 8.5 from <span aria-label="confused" class="emoji emoji-1f615" role="img" title="confused">:confused:</span></p>



<a name="219675583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219675583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219675583">(Dec 11 2020 at 23:43)</a>:</h4>
<p>ok I think I'm going to start by trimming down <code>clean::types::Span</code></p>



<a name="219675595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219675595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219675595">(Dec 11 2020 at 23:43)</a>:</h4>
<p>it's 100 bytes and all of it except the <code>rustc_span</code> can be rederived from a <code>tcx</code></p>



<a name="219681729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219681729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Poliorcetics <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219681729">(Dec 12 2020 at 01:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219671448">said</a>:</p>
<blockquote>
<p>if someone wants a copy LMK, I can arrange SFTP access but I don't know where else I can store 71 MB of JSON haha</p>
</blockquote>
<p>I have access to an "everything is public on this" server, I can host it if you wish</p>



<a name="219681731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219681731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Poliorcetics <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219681731">(Dec 12 2020 at 01:28)</a>:</h4>
<p>I believe it's not using https too</p>



<a name="219681833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219681833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219681833">(Dec 12 2020 at 01:31)</a>:</h4>
<p>actually I just realized I can host this on google drive haha</p>



<a name="219681844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219681844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Poliorcetics <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219681844">(Dec 12 2020 at 01:31)</a>:</h4>
<p>Yup, not https XD</p>



<a name="219681856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219681856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219681856">(Dec 12 2020 at 01:32)</a>:</h4>
<p><a href="https://drive.google.com/file/d/1QU6RdwTbm2jOpHSQo0pYo7JIwY9CnTTO/view?usp=sharing">https://drive.google.com/file/d/1QU6RdwTbm2jOpHSQo0pYo7JIwY9CnTTO/view?usp=sharing</a></p>



<a name="219683589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219683589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219683589">(Dec 12 2020 at 02:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219675595">said</a>:</p>
<blockquote>
<p>it's 100 bytes and all of it except the <code>rustc_span</code> can be rederived from a <code>tcx</code></p>
</blockquote>
<p><span class="user-mention" data-user-id="210316">@GuillaumeGomez</span> would you take a PR that passes <code>tcx</code> into <code>render</code>?</p>



<a name="219685957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219685957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219685957">(Dec 12 2020 at 03:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219675595">said</a>:</p>
<blockquote>
<p>it's 100 bytes and all of it except the <code>rustc_span</code> can be rederived from a <code>tcx</code></p>
</blockquote>
<p>meanwhile in places where people actually care about performance <a href="https://github.com/rust-lang/rust/blob/5bd9b60333b3dc0a51e7a5607cd1e0d537a9f718/compiler/rustc_span/src/span_encoding.rs#L15">https://github.com/rust-lang/rust/blob/5bd9b60333b3dc0a51e7a5607cd1e0d537a9f718/compiler/rustc_span/src/span_encoding.rs#L15</a></p>
<blockquote>
<p>/// <code>SpanData</code> is 12 bytes, which is a bit too big to stick everywhere.</p>
</blockquote>



<a name="219688419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219688419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219688419">(Dec 12 2020 at 04:09)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;Item&gt;() = 680
[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;ItemKind&gt;() = 408
[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;Span&gt;() = 8
</code></pre></div>
<p><span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span> <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="219688601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219688601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219688601">(Dec 12 2020 at 04:14)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/79957">https://github.com/rust-lang/rust/pull/79957</a></p>



<a name="219690695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219690695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219690695">(Dec 12 2020 at 05:07)</a>:</h4>
<p>next one on the list is Attributes, it takes up 96 bytes</p>



<a name="219695253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219695253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219695253">(Dec 12 2020 at 07:20)</a>:</h4>
<p>Cheering you on, <span class="user-mention" data-user-id="232545">@Joshua Nelson</span>.</p>



<a name="219707434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219707434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219707434">(Dec 12 2020 at 12:50)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219683589">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219675595">said</a>:</p>
<blockquote>
<p>it's 100 bytes and all of it except the <code>rustc_span</code> can be rederived from a <code>tcx</code></p>
</blockquote>
<p><span class="user-mention silent" data-user-id="210316">GuillaumeGomez</span> would you take a PR that passes <code>tcx</code> into <code>render</code>?</p>
</blockquote>
<p>Why do you need it? (I'm not opposed of it but I'm not sure why you would need it... For errors or for compiler queries? Or both maybe? XD)</p>



<a name="219707975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219707975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219707975">(Dec 12 2020 at 13:03)</a>:</h4>
<p><span class="user-mention" data-user-id="210316">@GuillaumeGomez</span> in this case it turned out I didn't need it, I could get all the info about Spans from a Session alone. In general I will need it to move computation from <code>clean</code> to the place it's used: <a href="https://github.com/rust-lang/rust/issues/76382">https://github.com/rust-lang/rust/issues/76382</a></p>



<a name="219707983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219707983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219707983">(Dec 12 2020 at 13:03)</a>:</h4>
<p>(deleted)</p>



<a name="219707984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219707984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219707984">(Dec 12 2020 at 13:03)</a>:</h4>
<p>I don't have a specific example for that, I'm happy to hold off until I do</p>



<a name="219708036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219708036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> GuillaumeGomez <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219708036">(Dec 12 2020 at 13:04)</a>:</h4>
<p>Oh nice!</p>



<a name="219711100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219711100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219711100">(Dec 12 2020 at 14:27)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219690695">said</a>:</p>
<blockquote>
<p>next one on the list is Attributes, it takes up 96 bytes</p>
</blockquote>
<p>actually I'll tackle ItemKind first</p>
<div class="codehilite"><pre><span></span><code>[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;ItemKind&gt;() = 408
[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;(Function, Option&lt;rustc_hir::Defaultness&gt;)&gt;() = 336
[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;Function&gt;() = 328
[src/librustdoc/lib.rs:102] std::mem::size_of::&lt;Impl&gt;() = 400
</code></pre></div>



<a name="219712791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219712791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219712791">(Dec 12 2020 at 15:12)</a>:</h4>
<p>hmm so Impl is tricky because it has a ton of logic in <code>clean</code> <a href="https://github.com/rust-lang/rust/blob/3f2088aa603d2cd3f43c20795872de9cd6ec7735/src/librustdoc/clean/mod.rs#L2083-L2130">https://github.com/rust-lang/rust/blob/3f2088aa603d2cd3f43c20795872de9cd6ec7735/src/librustdoc/clean/mod.rs#L2083-L2130</a></p>



<a name="219712801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219712801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219712801">(Dec 12 2020 at 15:13)</a>:</h4>
<p>maybe I could turn all those fields into methods, like before? I'm not sure how that interacts with caching</p>



<a name="219712870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/219712870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#219712870">(Dec 12 2020 at 15:15)</a>:</h4>
<p>I think for now I'll just box those variants</p>



<a name="220163574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/220163574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#220163574">(Dec 16 2020 at 19:48)</a>:</h4>
<p>(<a href="https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284">https://github.com/rust-lang/rust/pull/80014#issuecomment-746810284</a>)</p>
<blockquote>
<p>A way I thought of to reduce that size is to calculate them on demand with something like <code>enum ItemId</code></p>
</blockquote>
<p>lol this had exactly 343 errors</p>



<a name="220163589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/220163589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#220163589">(Dec 16 2020 at 19:48)</a>:</h4>
<p>maybe this is a sign I should take a break and play Halo <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="236091622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/DHAT%20and%20rustdoc/near/236091622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/DHAT.20and.20rustdoc.html#236091622">(Apr 25 2021 at 20:41)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232545">Joshua Nelson</span> <a href="#narrow/stream/122651-general/topic/DHAT.20and.20rustdoc/near/219690695">said</a>:</p>
<blockquote>
<p>next one on the list is Attributes, it takes up 96 bytes</p>
</blockquote>
<p>I took so long with this someone else is helping out <a href="https://github.com/rust-lang/rust/pull/84494">https://github.com/rust-lang/rust/pull/84494</a> :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>